/* globals process */

var buble = require('rollup-plugin-buble');
var uglify = require('rollup-plugin-uglify');
var nodeResolve = require('rollup-plugin-node-resolve');

var environment = process.env.ENV || 'development';
var isDevelopmentEnv = (environment === 'development');

// import obfuscatorPlugin from 'rollup-plugin-javascript-obfuscator';
//
// !isDevelopmentEnv && obfuscatorPlugin({
//     compact: true,
//     controlFlowFlattening: true,
//     controlFlowFlatteningThreshold: 0.75,
//     debugProtection: false,
//     debugProtectionInterval: false,
//     disableConsoleOutput: true,
//     identifierNamesGenerator: 'hexadecimal',
//     log: false,
//     renameGlobals: false,
//     rotateStringArray: true,
//     selfDefending: true,
//     stringArray: true,
//     stringArrayEncoding: 'base64',
//     stringArrayThreshold: 0.75,
//     transformObjectKeys: true,
//     unicodeEscapeSequence: false
// }),

module.exports = [
	{
		input: 'lib/udf-compatible-datafeed.js',
		name: 'Datafeeds',
		sourceMap: false,
		output: {
			format: 'umd',
			file: 'dist/bundle.js',
		},
		plugins: [
			nodeResolve({ jsnext: true, main: true }),
			buble(),
			!isDevelopmentEnv && uglify({ output: { inline_script: true } }),
		],
	}
];
